//package com.example.kafka.flink;
//
//import lombok.extern.slf4j.Slf4j;
//import org.apache.flink.api.common.serialization.SimpleStringSchema;
//import org.apache.flink.streaming.api.datastream.DataStream;
//import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
//import org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer;
//import org.springframework.stereotype.Component;
//
//import java.util.Properties;
//
//public class SourceTest3_Kafka {
//
//    public static void main(String[] args) throws Exception {
//        // 创建执行环境
//        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
//
//        // 设置并行度1
//        env.setParallelism(1);
//
//        Properties properties = new Properties();
//        properties.setProperty("bootstrap.servers", "60.60.60.209:9092");
//        // 下面这些次要参数
//        properties.setProperty("group.id", "nrMetric");
//        properties.setProperty("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
//        properties.setProperty("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
//        properties.setProperty("auto.offset.reset", "latest");
//
//        // flink添加外部数据源
//        DataStream<String> dataStream = env.addSource(new FlinkKafkaConsumer<String>("nr_metric_result", new SimpleStringSchema(),properties));
//
//        // 打印输出
//        dataStream.print();
//
//        env.execute();
//    }
//
//}
